import service from './request'
import md5 from 'js-md5'
import {useFlockInfoStore} from '@/stores/flockInfo'
import {useBaseParamStore} from '@/stores/baseParams'

const cqBaseUrl = import.meta.env.VITE_CQ_SERVER_URL
const accountId = import.meta.env.VITE_CQ_ACCOUNT_ID
const salt = import.meta.env.VITE_CQ_LOGIN_SALT
const headers = {'Content-Type': 'application/json'}

// 告警任务巡查预览
export const queryAlarmTaskOverview = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolDispatcher/alarmTaskOverview',
        {
            ...params
        },
        {
            headers: headers
        }
    )
}

// 查询任务调度统计区指标
export const getStatisticalIndicators = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolDispatcher/setStatisticalIndicators',
        {
            ...params
        },
        {
            headers: headers
        }
    )
}

// 查询服务员状态接口 
export const getWaiterStatus = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolDispatcher/setWaiterStatus',
        {
            ...params
        },
        {
            headers: headers
        }
    )
}

// 精准巡查任务监控看板（调度员）-已派单任务跟踪
export const getPendDispose = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolDispatcher/pendDispose',
        {
            ...params
        },
        {
            headers: headers
        }
    )
}

// 精准巡查任务监控看板（调度员）-待处理告警任务跟踪
export const getTrace = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolDispatcher/trace',
        {
            ...params
        },
        {
            headers: headers
        }
    )
}


// 精准巡查任务监控看板（服务部整体）-趋势分析
export const queryTend = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolPanelService/tend',
        {
            ...params
        },
        {
            headers: headers,
        }
    )
}

// 获取当前服务员最新定位
export const getTrajectoryPositioning = (params) => {
    return service.post(
        cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/getTrajectoryPositioning',
        {
            ...params
        },
        {
            headers: headers,
        }
    )
}